extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "奥羽"                   # 角色的名称
	attCoe.atkRan = 1                 # 攻击距离
	attCoe.maxHp = 6.4                 # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 5                   # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 1                 # 魔法攻击（每点代表13.7）
	attCoe.def = 5                   # 物理防御（每点代表15）
	attCoe.mgiDef = 4.6               # 魔法防御（每点代表16.6）
	atkEff = "atk_dao" 
	xb = "神秘"
	lv = 3
	addSkillTxt("[无尽曙光]每秒有8%的概率进入持续5秒的<希望之神>状态")
	addSkillTxt("[神盾阻灭]奥羽和奥天以外的友军受到技能伤害时，50%概率减少30%伤害\n奥羽和奥天以外的友军普攻时30%概率援护普攻")
	addSkillTxt("[灵魂燃烧]燃烧灵魂，提升自身物攻和物防各10%，最高至60%[CD:12]")
	addCdSkill("lhrs",12)

func _upS():
	._upS()
	if sys.rndPer(8):
		addBuff(shuguang.new(5))

func _onBattleStart():
	._onBattleStart()
	for i in getAllChas(2):
		if i.id != "calxsm_2_2" && i.id != "calxsm_2_2_1":
			i.addBuff(shendun.new(self))
			i.addBuff(lhrs1.new(self))

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "lhrs":
		var b = hasBuff("wugong1")
		var b1 = hasBuff("wukang1")
		if b == null:
			addBuff(wugong1.new())
		elif b.att.atkL < 0.6:
			b.att.atkL += 0.1
		if b1 == null:
			addBuff(bf.wukang1.new())
		elif b1.att.defL < 0.6:
			b1.att.defL += 0.1

class wugong1:
	extends Buff
	func _init():
		attInit()
		var dispelable = false
		id = "wugong1"	
		att.atkL += 0.1
			
class lhrs1:
	extends Buff
	var cha
	var dispelable = false
	func _init(cha = null):
		attInit()
		id = "lhrs1"
		self.cha = cha
	func _connect():
		if masCha.chaName.find("奥羽") == -1 && masCha.chaName.find("奥天") == -1:
			masCha.connect("onAtkChara",self,"run")
	func run(atkInfo):
		if atkInfo.atkType == Chara.AtkType.NORMAL && sys.rndPer(30):
			cha.normalAtkChara(atkInfo.hitCha)

class shendun:
	extends Buff
	var cha
	var dispelable = true
	func _init(cha = null):
		attInit()
		id = "shendun"
		self.cha = cha
	func _connect():
		if masCha.chaName.find("奥羽") == -1 && masCha.chaName.find("奥天") == -1:
			masCha.connect("onHurt",self,"run")
	func run(atkInfo):
		if atkInfo.atkType == Chara.AtkType.SKILL && sys.rndPer(50):
			atkInfo.hurtVal *= 0.7

class shuguang:
	extends Buff
	var damage=0
	var dispelable = true
	func _init(lv=1,fire=1):
		attInit()
		id = "shuguang"
		life=lv
		damage=max(fire,damage)
	func _connect():
		masCha.connect("onAddBuff",self,"onAddBuff")
		masCha.connect("onHurt",self,"_onHurt")
	func onAddBuff(buff):
		if buff.isNegetive:
			buff.isDel = true
	func _onHurt(atkInfo:AtkInfo):
		if atkInfo.hurtVal >= masCha.att.hp:
			masCha.att.hp = 1
			atkInfo.hurtVal = 0




